package main

import (
	"hw07/server"
	"os"

	"github.com/spf13/pflag"
)

func main() {
	port := os.Getenv("PORT")
	// 默认port为2125
	if len(port) == 0 {
		port = "2125"
	}
	// 解析port
	currentPort := pflag.StringP("port", "p", "2125", "Port for http listening")
	pflag.Parse()
	if len(*currentPort) != 0 {
		port = *currentPort
	}
	// 启动服务器
	m := server.NewServer()
	m.Run(":" + port)
}
